<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 刘洋
  Date: 2019/10/29
  Time: 9:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
	<title>题目管理</title>
	<jsp:include page="/layout/_imports.jsp"></jsp:include>
</head>
<body>
<jsp:include page="/layout/_nav.jsp"></jsp:include>
<div class="container">
	<h2>题目管理</h2>

	<table class="table" style="text-align: center">
		<thead class="thead-dark">
		<tr>
			<th scope="col">id</th>
			<th scope="col">标题</th>
			<th scope="col">内容</th>
			<th scope="col">分数</th>
			<th scope="col">答案</th>
			<th scope="col">多选</th>
			<th scope="col">操作</th>
		</tr>
		</thead>
		<tbody>
		<c:forEach items="${items}" var="i">
			<tr>
				<th scope="row">${i.id}</th>
				<td>${i.title}</td>
				<td>${i.allChooseItemDescribe}</td>
				<td>${i.score}</td>
				<td>${i.answer}</td>
				<td>${i.multiple}</td>
				<td>
					<form action="${pageContext.request.contextPath}/item">
						<input type="hidden" name="state" value="delete">
						<input type="hidden" name="id" value="${i.id}">
						<a href="/item?state=edit&id=${i.id}" class="btn btn-primary">编辑</a>
						<button type="submit" class="btn btn-danger"
								onclick="return confirm('确认删除？')">删除
						</button>
					</form>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<c:if test="${not empty msg}">
		<div class="alert alert-danger">${msg}</div>
	</c:if>

	<a href="/admin/AddItem.jsp" class="btn btn-primary">添加题目</a>
</div>


</body>
</html>
